package controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import po.Order;
import service.OrderService;

import java.util.List;

/**
 * Created by apple on 2017/10/21.
 */

@Controller
public class OrderController {

    @Autowired
    private OrderService orderService;

    @RequestMapping(value = "/showMyOrders.do", produces = "text/html;charset=UTF-8")
    @ResponseBody
    public String showMyOrders(String username) {
        List<Order> orders = orderService.selectOrderInfo(username);
        return orders.toString();
    }

    @RequestMapping(value = "/showAllOrders.do", produces = "text/html;charset=UTF-8")
    @ResponseBody
    public String showAllOrders() {
        List<Order> orders = orderService.selectAllOrders();
        return  orders.toString();
    }


}
